
//package java_cup;

/** A specialized version of a production used when we split an existing
 *  production in order to remove an embedded actionPart.  Here we keep a bit 
 *  of extra bookkeeping so that we know where we came from.
 * @version last updated: 11/25/95
 * @author  Scott Hudson
 */

public class ActionProduction : ProductionDraft {

    /** Constructor.
     * @param base       the production we are being factored @out of.
     * @param lhs_sym    the LHS SymbolDraft for this production.
     * @param rhs_parts  array of production parts for the RHS.
     * @param rhs_len    how much of the rhs_parts array is valid.
     * @param action_str the trailing reduce actionPart for this production.
     * @param _indexOfIntermediateResult the index of the result of the previous intermediate actionPart on the stack relative to Peek, -1 if no previous actionPart
     */
    public ActionProduction(
      ProductionDraft @base,
      Vn lhsSym,
      ProductionPart[] rhsParts,
      int rhsLen,
      String actionStr,
      int indexOfIntermediateResult)
        /*throws internal_error*/
        : base(lhsSym, rhsParts, rhsLen, actionStr) {
        _base_production = @base;
        this._indexOfIntermediateResult = indexOfIntermediateResult;
    }
    public int _indexOfIntermediateResult;
    /**
     * @return the index of the result of the previous intermediate actionPart on the stack relative to Peek, -1 if no previous actionPart
     */
    public int IndexOfIntermediateResult => _indexOfIntermediateResult;
    /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/

    /** The production we were taken @out of. */
    public ProductionDraft _base_production;

    /** The production we were taken @out of. */
    public ProductionDraft BaseProduction => _base_production;
}
